<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>7</title>
</head>
<body>
<script>
    //输入一个正整数n，计算[1,n]之间的偶数和，并统计有多少个偶数,并打印
    var n=10;//[1,10]
    var sum=0;
    var count=0;
    for (let i = 1; i <= n; i++) {
        if (i%2==0){
            sum+=i;
            count++;
        }
    }
    console.log("[1,"+n+"]之间的偶数和:"+sum,"有"+count+"个偶数");



</script>
</body>
</html>